package game;

import javax.swing.ImageIcon;

public class PlayerDTO {
	

	private PlayerDAO player1;
	private PlayerDAO player2;
	private PlayerDAO currentPlayer;
	private static PlayerDTO INSTANCE=null;
	
	
	public PlayerDTO(){
		INSTANCE=this;
	}
	
	public void setPlayers(PlayerDAO inPlayer1, PlayerDAO inPlayer2){
		
		currentPlayer = player1 = inPlayer1;
		player2 = inPlayer2;
	}
	
	public static PlayerDTO getInstance(){
		if (PlayerDTO.INSTANCE==null){
			new PlayerDTO();
		}
		return PlayerDTO.INSTANCE;
	}
	
	public PlayerDAO getCurrentPlayer() {
		return currentPlayer;
	}
	
	public void setPlayerFigures(){
		
		if (player1.getChoosenFigure()==PlayerDAO.FIGURE_DOG){
			
			player1.setFigure(new ImageIcon("images/"+GameLogic.getInstance().getFolderName()+"Figures/Figure_dog.png"));
			
		}else {
			player1.setFigure(new ImageIcon("images/"+GameLogic.getInstance().getFolderName()+"Figures/Figure_car.png"));
		}
		
		if (player2.getChoosenFigure()==PlayerDAO.FIGURE_DOG){
			
			player2.setFigure(new ImageIcon("images/"+GameLogic.getInstance().getFolderName()+"Figures/Figure_dog.png"));
			
		}else {
			player2.setFigure(new ImageIcon("images/"+GameLogic.getInstance().getFolderName()+"Figures/Figure_car.png"));
		}
	}

	public void setCurrentPlayer(PlayerDAO currentPlayer) {
		this.currentPlayer = currentPlayer;
	}

	public PlayerDAO getPlayer1() {
		return player1;
	}

	public PlayerDAO getPlayer2() {
		return player2;
	}

	

}
